package com.top.up.core.execption;

import com.top.up.enums.ResultEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CommonException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private String code;

    public CommonException(String code, String msg) {
        super(msg);
        this.code = code;
    }

    public CommonException(ResultEnum ee) {
        super(ee.getMsg());
        this.code = ee.getCode();
    }

    public CommonException(ResultEnum ee, Throwable t) {
        super(ee.getMsg(), t);
        this.code = ee.getCode();
    }

}
